#!/bin/sh

# Allow startup from a user session where WAYLAND_DISPLAY is set,
# e.g. to restart via /etc/init.d/S31emulationstation start
unset WAYLAND_DISPLAY

# Log and configuration file paths
LOG_FILE="/userdata/system/logs/display.log"
LABWC_CONF_DIR="/userdata/system/.config/labwc"
LABWC_LOG_FILE="/var/log/labwc.log"

mkdir -p /userdata/system/logs
mkdir -p /var/run
mkdir -p /var/log

# Start Labwc with specified environment variable, logging output
echo "Starting Labwc..." >> "$LOG_FILE"

WLR_LIBINPUT_NO_DEVICES=1 /usr/bin/labwc -d -C $LABWC_CONF_DIR > "$LABWC_LOG_FILE" 2>&1
